package com.jetinno.parts

import android.text.TextUtils
import com.jetinno.parts.MilkNames.Companion.FM
import com.jetinno.parts.MilkNames.Companion.FV

/**
 * Created by zhangyuncai on 2023/2/10.
 */
class PartsInfo constructor(val machineModel: String = "JL300_ES_7C") : java.io.Serializable {
    var machineName = "JL300"//机器名称
    var esName: String? = ""//酿造器/泡茶器类型
    var hasJLY = false//Y表示在原配置上增加自动压杯盖功能，例如JL500Y或者JL500_Y
    var hasJLI = false//I表示在原配置上增加内置制冰模组；例如JL500I
    var hasJLIM = false//外置制冰机模组（注：内置制冰机将"I"放在型号之后,例如JL500I）
    var hasCooler = false//是否有冷水机
    var hasIW = false//单独出水传感器//由开发者独创命名Independent of the water
    var binNums = 0//速溶料盒+咖啡豆盒的数量
    var beanboxNums = 0//豆盒数量
    var instantNums = 0//速溶料盒数量
    var bibNums = 0//bib的数量
    var brewerNums = 0//酿造器数量
    var teabrewerNums = 0//泡茶器数量
    var grinderNums = 0//研磨器数量
    var isInstantMachine = false//速溶机
    var milkName: String? = ""//鲜奶机类型
    var syrupNums = 0//糖浆电机数量


    ///是否柜机
    fun stand(): Boolean {
        return MachineNames.standList.contains(machineName)
    }

    ///是否台机
    fun table(): Boolean {
        return !stand()
    }

    fun milkFM() = TextUtils.equals(FM, milkName)
    fun milkFV() = TextUtils.equals(FV, milkName)
    override fun toString(): String {
        return "PartsInfo(machineModel='$machineModel', machineName='$machineName', esName=$esName, hasJLY=$hasJLY, hasJLI=$hasJLI, hasJLIM=$hasJLIM, hasCooler=$hasCooler, hasIW=$hasIW, binNums=$binNums, beanboxNums=$beanboxNums, instantNums=$instantNums, bibNums=$bibNums, brewerNums=$brewerNums, teabrewerNums=$teabrewerNums, grinderNums=$grinderNums, isInstantMachine=$isInstantMachine, milkName=$milkName, syrupNums=$syrupNums)"
    }


}

///鲜奶机类型
class MilkNames {
    companion object {
        const val FM = "_FM" //带奶泵冷热打奶泡功能
        const val FV = "_FV" //带文丘里打奶泡功能（只能打热奶泡）
    }
}

///ES类型
class ESNames {
    companion object {
        const val ES = "ES" //一个咖啡豆盒+一个研磨器+一个咖啡酿造器（专为Espresso功能）的组合
        const val ESBTC = "ESBTC" //ES+BTC组合
        const val FB = "FB" //一个茶粉/咖啡粉料盒+一个FB冲泡器（茶滤网/咖啡滤网）的组合
        const val BTC = "BTC" //一个咖啡豆盒+一个研磨器+一个FB冲泡器（咖啡滤网）的组合
        const val TS = "TS" //一个茶粉/咖啡粉料盒+一个茶酿造器（茶滤网/咖啡滤网）的组合
        const val LC = "LC" //一个咖啡豆盒+一个研磨器+一个咖啡酿造器（专为Long coffee咖啡功能）的组合
        const val IN = "IN" //全部是速溶料盒+搅拌器的组合，多少个料盒表示为INxC (其中IN只体现在全部都是速溶料盒的机型中)
        const val _2ES = "2ES" //等同旧规则中的2xES，注意是：两个咖啡豆盒+两个研磨器+一个意式咖啡冲泡器的组合（不是两个高压冲泡
        const val ESFB = "ESFB" //ES配置+FB配置组合
        const val _2FB = "2FB" //两组FB配置组合
        const val _2TS = "2TS" //两组TS配置组合
        const val ESLC = "ESLC" //ES配置+LC配置组合

        @JvmStatic
        val esNameList = arrayListOf(
                ES,
                ESBTC,
                FB,
                BTC,
                TS,
                LC,
                IN,
                _2ES,
                ESFB,
                _2FB,
                _2TS,
                ESLC
        )
    }
}

/**
 * Created by zhangyuncai.
 * Date: 2022/10/5
 * 这里列出所有支持的机器型号
 */
class MachineNames {
    companion object {
        //判断机器台柜机
        const val JLTTN = "JLTTN"
        const val JLTT = "JLTT"
        const val JL18 = "JL18"
        const val JL22 = "JL22"
        const val JL23 = "JL23"
        const val JL24 = "JL24"
        const val JL26 = "JL26"
        const val JL28 = "JL28"
        const val JL35 = "JL35"
        const val JL50 = "JL50"

        const val FS170 = "FS170"
        const val JL220 = "JL220"
        const val JL300 = "JL300"
        const val JL320 = "JL320"
        const val JL500 = "JL500"
        const val JL510 = "JL510"
        const val JL550 = "JL550"
        const val JL560 = "JL560"
        const val JL800 = "JL800"
        const val JL801 = "JL801"
        const val JL820 = "JL820"
        const val JL828 = "JL828"
        const val JL852 = "JL852"

        //所有机型
        @JvmStatic
        val allList: MutableList<String> = arrayListOf(//字符串长度 长的放在前面 短的放在后面
                JL300,
            JL220,
            JL320,
                JL500,
            JL510,
            JL550,
            JL560,
                FS170,
                JL852,
                JL800,
                JL801,
                JL820,
                JL828,
                JLTTN,
                JLTT,
                JL18,
                JL28,
                JL22,
                JL23,
                JL24,
                JL26,
                JL35,
                JL50
        )

        //台机
        val tableList: MutableList<String> = arrayListOf(
                JLTTN,
                JLTT,
                JL18,
                JL28,
                JL22,
                JL23,
                JL24,
                JL26,
                JL35,
                JL50
        )

        //柜机
        val standList: MutableList<String> = arrayListOf(
                JL300,
            JL220,
            JL320,
                JL500,
            JL510,
            JL550,
            JL560,
                FS170,
                JL852,
                JL800,
                JL801,
                JL820,
                JL828
        )

        //指示灯
        val indicatorLightList: MutableList<String> = arrayListOf(
                JL300,
            JL220,
            JL320,
                JL500,
            JL510,
            JL550,
            JL560,
                FS170,
                JL852,
                JL800,
                JL801,
                JL820,
                JL828,
                JL28
        )
    }

}

class PartIds {
    companion object {
        const val parts_all = 1000 //整机

        const val parts_brewer = 2000 //含有酿造器
        const val parts_brewer1 = 2100 //酿造器1
        const val parts_brewer2 = 2200 //酿造器2

        const val parts_teabrewer = 3000 //含有泡茶器
        const val parts_teabrewer1 = 3100 //泡茶器1
        const val parts_teabrewer2 = 3200 //泡茶器2

        const val parts_beater = 4000 //含有搅拌器
        const val parts_beater1 = 4100 //搅拌器1
        const val parts_beater2 = 4200 //搅拌器2
        const val parts_beater3 = 4300 //搅拌器3
        const val parts_beater4 = 4400 //搅拌器4
        const val parts_beater5 = 4500 //搅拌器5
        const val parts_beater6 = 4600 //搅拌器6

        const val parts_discharge = 5000 //含有出料电机
        const val parts_discharge1 = 5100 //出料电机1
        const val parts_discharge2 = 5200 //出料电机2
        const val parts_discharge3 = 5300 //出料电机3
        const val parts_discharge4 = 5400 //出料电机4
        const val parts_discharge5 = 5500 //出料电机5
        const val parts_discharge6 = 5600 //出料电机6
        const val parts_discharge7 = 5700 //出料电机7
        const val parts_discharge8 = 5800 //出料电机8

        const val parts_ice = 6000 //制冰机

        const val parts_milk = 7000 //奶泡机

        const val parts_cold = 8000 //冷水机

        const val parts_cup = 9000 //分杯系统

        const val parts_lid = 10000 //压盖系统

        const val parts_syrup = 11000 //含有糖浆机
        const val parts_syrup1 = 11100 //糖浆机1
        const val parts_syrup2 = 11200 //糖浆机2
        const val parts_syrup3 = 11300 //糖浆机3
        const val parts_syrup4 = 11400 //糖浆机4
        const val parts_syrup5 = 11500 //糖浆机5
        const val parts_syrup6 = 11600 //糖浆机6

        const val parts_watersensor = 12000 //单独出水传感器

        const val parts_grinder = 13000 //含有研磨器
        const val parts_grinder1 = 13100 //研磨器1
        const val parts_grinder2 = 13200 //研磨器2

        const val parts_beanbox = 14000 //含有咖啡豆盒
        const val parts_beanbox1 = 14100 //咖啡豆盒1
        const val parts_beanbox2 = 14200 //咖啡豆盒2

        const val parts_smalldoor = 15000 //小门

        const val parts_bigdoor = 16000 //大门

        const val parts_drip = 17000 //滴水盘检测

        const val parts_addle = 18000 //脏水通满检测

        const val parts_light = 19000 //灯

        const val parts_light_indicator = 19100 //指示灯

        const val parts_light_uv = 19200 //紫外灯

        const val parts_flowmeter = 20000 //含有流量计
        const val parts_flowmeter1 = 20100 //流量计1
        const val parts_flowmeter2 = 20200 //流量计2

        const val parts_brewerboiler = 21000 //酿造器锅炉

        const val parts_gearpump = 22000 //齿轮泵(该零件可以设置各种参数),另一种零件叫做柱塞泵(该零件不能设置参数)

        const val parts_ts_beater = 23100 //含有TS接搅拌
        const val parts_ts_beater1 = 23100 //TS1接搅拌
        const val parts_ts_beater2 = 23200 //TS2接搅拌

        const val parts_bib = 24000 //BIB
        const val parts_bib1 = 24100 //BIB1
        const val parts_bib2 = 24200 //BIB2
        const val parts_bib3 = 24300 //BIB3
        const val parts_bib4 = 24400 //BIB4
        const val parts_bib5 = 24500 //BIB5
        const val parts_bib6 = 24600 //BIB6
        const val parts_bib7 = 24700 //BIB7
        const val parts_bib8 = 24800 //BIB8

        const val parts_watertray = 25000 //接水盘

        const val parts_tablespeedfan = 26000 //台机调速扇

        const val parts_breathinglamp = 27000 //呼吸效果灯控制

        const val parts_machinerunninglamp = 28000 //机器运行灯控制

        const val parts_cupsensor = 29000 //探杯传感器

        const val parts_tea_air_valve = 30000 //单独空气泵阀

        const val parts_cup_sleeve = 31000 //杯套

    }
}